package cn.fl.mcr.transform;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.mcr.vo.McrBillMReVO;
import cn.fl.mcr.vo.McrBillMVO;
import cn.lionbridgecapital.loan.model.dto.McrBillMDTO;
import cn.lionbridgecapital.loan.model.dto.McrBillMReDTO;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 小贷账单主表 转换器
 * VO是客户端传递数据到服务端进行转换的数据 
 * VO转换数据变成DTO传递到服务端 
 * VO不能在服务端出现
 */
public class McrBillMReVOTransform {
	/**
	 * DTO 转  VO
	 * @param dto McrBillMDTO
	 * @return McrBillMVO
	 */
	public static McrBillMReVO toVO(McrBillMReDTO dto) {
		McrBillMReVO vo = null;
		if (dto != null) {
			vo = new McrBillMReVO();
			vo.setCstId(dto.getCstId());
			vo.setCstNm(dto.getCstNm());
			vo.setBillID(dto.getBillId());
			vo.setCrCntNo(dto.getCrCntNo());
			vo.setCrCntNoNew(dto.getCrCntNoNew());
			vo.setCrAmt(dto.getCrAmt()+"");
			vo.setCrDt(dto.getCrDt());
			vo.setIsSettle(dto.getIsSettle());
			vo.setCrRatePct(dto.getCrRatePct());
			vo.setId(dto.getId());
			vo.setCrtUsrId(dto.getCrtUsrId());
			vo.setCrtTm(dto.getCrtTm());
			vo.setMdfUsrId(dto.getMdfUsrId());
			vo.setMdfTm(dto.getMdfTm());

		}
		return vo;
	}

	/**
	 * DTO集合 转 VO集合
	 * @param list List<McrBillM>
	 * @return List<McrBillMDTO>
	 */
	public static List<McrBillMReVO> toVOList(List<McrBillMReDTO> list) {
		List<McrBillMReVO>  voList = new ArrayList<>();
		if(CollectionUtils.isNotEmpty(list)){
			for (McrBillMReDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
}
